home *** CD-ROM | disk | FTP | other *** search
/ ArtRageous! the Amazing World of Art / ArtRageous - The Amazing World of Art (1995)(Softkey).iso / data / artmain.dir / 00094_Script_QTVR Mac Scripts < prev    next >
Text File  |  1995-12-14  |  29KB  |  736 lines

  1.  
  2. -- ⌐ 1992-1995 Apple Computer, Inc.  All rights reserved.
  3.  
  4. --=============================================================================
  5. -- Routines for initializing and cleaning up the Director movie.
  6. -------------------------------------------------------------------------------
  7.  
  8.  
  9. --=============================================================================
  10. -- StartMovie
  11. --
  12. -- Runs at movie start time.  Initializes key globals, opens the external code
  13. -- library, registers the QuickTime VR components, and sets up the XCMD Callback
  14. -- Factory.
  15. -------------------------------------------------------------------------------
  16. on InitQTVRMac
  17.   global gPanoMovieID, gNavMovieID, gPathName, gLastTimeRollover, gPanoFrame
  18.   put empty into gPanoMovieID
  19.   put empty into gNavMovieID
  20.   put empty into gPathName
  21.   put false into gLastTimeRollover
  22.   put empty into gPanoFrame
  23.   
  24.   -- Need to open up the external xlib so that we don't have the
  25.   -- XCMD floating-point bug problem when we save.
  26.   -- This would be commented out just before we turn this into a projector.
  27.   
  28.   openxlib (the pathName & "ARTMAINA:QuickTime VR XCMDs")
  29.   
  30.   -- Register the QuickTime VR component
  31.   -- This would turn into RegisterComponent (":", empty) when the components are
  32.   -- embedded in the projector.
  33.   
  34.   RegisterComponent (the pathname & "ARTMAINA:QuickTime VR Components", empty)
  35.   
  36.   -- Need to set up the XCMD Callback Factory so that we can execute callbacks
  37.   -- to Lingo handlers from PanoMovie
  38.   
  39.   global gQTVRCallBackFactory
  40.   put CallBackTracer(mNew) into gQTVRCallBackFactory
  41.   SetCallBack PanoMovie,gQTVRCallBackFactory
  42. end InitQTVR
  43.  
  44.  
  45. --=============================================================================
  46. -- StopMovie
  47. --
  48. -- Runs at movie stop time.  Closes any open pano or nav movies.  Disposes
  49. -- of the XCMD Callback Factory and closes the external code library.
  50. -------------------------------------------------------------------------------
  51. on disposeQTVRMac
  52.   -- Close any open panoramic or object movies
  53.   ClosePanoMovieMac
  54.   CloseNavMovieMac
  55.   
  56.   -- Close the external XCMD library
  57.   -- This would be commented out just before we turn this into a projector.
  58.   
  59.   closexlib (the pathname & "ARTMAINA:QuickTime VR XCMDs")
  60.   
  61.   -- Dispose of the XCMD Callback Factory
  62.   global gQTVRCallBackFactory
  63.   if objectP(gQTVRCallBackFactory) then gQTVRCallBackFactory (mDispose)
  64. end disposeQTVRMac
  65.  
  66.  
  67. --=============================================================================
  68. -- Routines for managing navigable movies
  69. -------------------------------------------------------------------------------
  70.  
  71.  
  72. --=============================================================================
  73. -- OpenNavMovieMac:
  74. --      pFilename is the full file path of the file
  75. --      pSpriteNum is the sprite associated with the direct Nav Movie
  76. --      pShowOnOpen is a boolean for showing the movie on screen immediately
  77. --
  78. -- Opens the file pFileName as a nav movie at the top left corner of sprite
  79. -- pSpriteNum.  Shows it on the screen as dictated by pShowOnOpen.
  80. -------------------------------------------------------------------------------
  81. on OpenNavMovieMac pFilename, pSpriteNum, pShowOnOpen
  82.   global gNavMovieID
  83.   
  84.   -- The use of a single global gNavMovieID constrains these routines 
  85.   -- to only allow one pano movie to be open at a time.
  86.   -- Close any other open nav movie.
  87.   CloseNavMovieMac
  88.   
  89.   -- Load in the movie.  Assume the underlying sprite is the correct size.
  90.   put NavMovie ("openMovie", "Direct", pFilename ,¼
  91.                 the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum, ¼
  92.                 "ShowPoster", "Invisible") into gNavMovieID
  93.   if gNavMovieID contains "error" then 
  94.     put gNavMovieID
  95.     put empty into gNavMovieID
  96.     beep
  97.     exit
  98.   end if
  99.   
  100.   if pShowOnOpen then
  101.     -- Show the poster frame of the nav movie on screen
  102.     NavMovie "Direct", gNavMovieID, "update"
  103.   end if
  104. end OpenNavMovie
  105.  
  106.  
  107. --=============================================================================
  108. -- ShowNavMovie
  109. --
  110. -- Updates the nav movie display on screen.
  111. -------------------------------------------------------------------------------
  112. on ShowNavMovieMac
  113.   global gNavMovieID
  114.   if gNavMovieID <> empty then
  115.     NavMovie "Direct", gNavMovieID, "update"
  116.   end if
  117. end ShowNavMovieMac
  118.  
  119.  
  120. --=============================================================================
  121. -- ZoomNavMovie:
  122. --      pStartZoomRect specifies the start rect as a string rect
  123. --      [pSkipFirstFrame] is "true" if the first zoom frame should not be shown
  124. --      [pClipRect] is the screen string rect to which the zoom should be clipped
  125. --
  126. -- Zooms the nav movie out from the start rect specified, possibly skipping
  127. -- the first frame and clipping to a given rect.
  128. -------------------------------------------------------------------------------
  129. on ZoomNavMovieMac pStartZoomRect, pSkipFirstFrame, pClipRect
  130.   global gNavMovieID
  131.   if gNavMovieID <> empty then
  132.     put "ZoomOutMovie" && quote & pStartZoomRect & quote into tCommand
  133.     if not voidP(pSkipFirstFrame) then
  134.       put tCommand & "," & pSkipFirstFrame into tCommand
  135.     end if
  136.     if not voidP(pClipRect) then
  137.       put tCommand & "," & quote & pClipRect & quote into tCommand
  138.     end if  
  139.     NavMovie "Direct", gNavMovieID, tCommand
  140.     -- Send an idle so that if MoviesTask() is called, we don't get a
  141.     -- spurious update
  142.     NavMovie "Direct", gNavMovieID, "idle"
  143.   end if
  144. end ZoomNavMovieMac
  145.  
  146.  
  147. --=============================================================================
  148. -- SetNavMovieViewMac:
  149. --      pHPan is the horizontal pan angle
  150. --      pVPan is the vertical pan angle
  151. --
  152. -- Sets the nav movie view to the specified pan angles.
  153. -------------------------------------------------------------------------------
  154. on SetNavMovieViewMac pHPan, pVPan
  155.   global gNavMovieID
  156.   if gNavMovieID <> empty then
  157.     NavMovie "Direct", gNavMovieID, "set", "hPanAngle", pHPan
  158.     NavMovie "Direct", gNavMovieID, "set", "vPanAngle", pVPan
  159.   end if
  160. end SetNavMovieViewMac
  161.  
  162.  
  163. --=============================================================================
  164. -- CloseNavMovieMac
  165. --
  166. -- Disposes an open nav movie.  This does not remove the image from
  167. -- the screen.
  168. -------------------------------------------------------------------------------
  169. on CloseNavMovieMac
  170.   global gNavMovieID
  171.   if gNavMovieID <> empty then
  172.     NavMovie "Direct", gNavMovieID, "dispose"
  173.     put empty into gNavMovieID
  174.   end if 
  175. end CloseNavMovieMac
  176.  
  177.  
  178. --=============================================================================
  179. -- NavFrameScript
  180. --      pSpriteNum is the sprite which lies under the nav movie
  181. --
  182. -- When run frequently, provides cursor feedback over the nav movie
  183. -- and handles mouse down and keyboard actions.
  184. -------------------------------------------------------------------------------
  185. on NavFrameScriptMac pSpriteNum
  186.   global gNavMovieID
  187.   if gNavMovieID <> empty and RunningInForeground() = "true" then 
  188.     if rollover (pSpriteNum) then
  189.       NavMovie "Direct", gNavMovieID, "mouseOver"
  190.       
  191.       -- Set the cursor twice because Director tries to be smart and
  192.       -- doesn't change the cursor if your current cursor command
  193.       -- is the same as the last one.  It doesn't realize of course,
  194.       -- that QTVR has changed the cursor in between.
  195.       
  196.       -- KNOWN BUG: It appears that the cursor command is ignored if the mouse
  197.       -- is not over the stage, so if you move out of the movie window
  198.       -- fast enough and off the stage, the cursor will remain unchanged.
  199.       
  200.       cursor 200
  201.       cursor -1
  202.     else
  203.       NavMovie "Direct", gNavMovieID, "idle"
  204.     end if
  205.   end if
  206. end NavFrameScriptMac
  207.  
  208.  
  209. --=============================================================================
  210. -- Routines for managing panoramic movies
  211. -------------------------------------------------------------------------------
  212.  
  213.  
  214. --=============================================================================
  215. -- OpenPanoM